package com.mvn.kitty;
import java.io.IOException;

import org.apache.http.HttpResponse;
import org.apache.http.client.*;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
public class Core {
	public void core()  {
		System.out.println("core method!");
		
		//到指定URL发送请求,然后获取响应信息.
		
		String url = "http://www.baidu.com";
		HttpPost hp = new HttpPost(url);
		
		HttpClient hc = new DefaultHttpClient();
		try {
			HttpResponse hr = hc.execute(hp);
			if (hr.getStatusLine().getStatusCode() == 200) {
				System.out.println(EntityUtils.toString(hr.getEntity()));
			} else {
				System.out.println(hr.getStatusLine().getStatusCode() + "\n" + EntityUtils.toString(hr.getEntity()));
			}
		} catch (ClientProtocolException e) {
			
			e.printStackTrace();
		} catch (IOException e) {
			
			e.printStackTrace();
		}
		
	}
	public static void main(String[] args) {
		Core core = new Core();
		core.core();
	}
}
